<div class="span-19 options-holder">
	<?= $this->partial('_partial/common_public_head.phtml', array('controller' => 'image')) ?>
</div>
<div class="span-5 last options-holder">
	<ul class="options-list top-right">
		<li><a title="Dodaj aktualność" class="action add" href="<?php
	    	print $this->url(array(
	    		'controller' => 'image',
	  			'action'=>'add'
	    	));
	    ?>">Dodaj grafikę</a></li>
	</ul>
</div>

<hr class="bottom"/>

<div class="box text-right">
	<?= $pagination = $this->paginationControl($this->paginator, 'Sliding','_partial/pagination.phtml'); ?>
</div>

<hr class="bottom"/>

<table>
  <col span="1"/>
  <col class="even" span="2"/>
 <thead>
  <tr>
    <th>Miniaturka</th>
    <th class="span-1">&nbsp;</th>
    <th class="span-1">&nbsp;</th>
  </tr>
 </thead>
 <tbody>
  <?php if(count($this->rowset) < 1): ?>

   <tr>
    <td colspan="3"><p class="msg-notice bottom">Brak rekordów</p></td>
   </tr>

  <?php else: ?>

  <?php
  	$imageDefaultUrl = $this->url(array(
		'type' => 'thumb',
		'file' => '{file}'
	),'galleryImage', true, false);
  ?>

  <?php
  	foreach ($this->rowset as $row):
  	// chyba zwiekszy co nieco wydajnosc ;]
	$imageUrl = str_replace('{file}', $row->image, $imageDefaultUrl);
  ?>
  
  <tr>
   <td><img src="<?php print $imageUrl ?>" alt="Grafika"/></td>
   <td><a class="action edit small" href="<?php
    	print $this->url(
    		array(
    			'controller' => 'image',
	  			'action'=>'edit',
	  			'id' => $row->id
    		));
    ?>">edytuj</a></td>
    <td class="center"><a
    	title="Usuń"
    	onclick="return confirm('Czy usunąć rekord?');"
    	class="action trash ico small" href="<?php
    	print $this->url(
    		array(
    			'controller' => 'image',
	  			'action'=>'delete',
	  			'id' => $row->id
    		));
    ?>">usuń</a></td>
  </tr>
  <?php endforeach; ?>

  <?php endif; ?>
 </tbody>
</table>

<div class="box text-right">
	<?= $pagination ?>
</div>